<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>首页</title>
    <script type="text/javascript" src="script/ui.js"></script>
    <link rel="stylesheet" type="text/css" href="./css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="./css/api.css"/>
    <link rel="stylesheet" type="text/css" href="./css/mui.min.css">
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" type="text/css" href="css/news.css">
    <style type="text/css">
        #wrap {
            margin: 0px;
            padding: 0px;
            background-color: #f3f5f7;
        }

        .iconFrame {
            /*margin-top: 200px;*/
            padding-top: 10px;
            padding-bottom: 10px;
            font-size: 16px;
            width: 20%;
            height: 80px;
            text-align: center;
            float: left;
        }

        .imgSet {
            margin-top: 4px;
            width: 42px;
            height: 42px;
        }

        .functionButton {
            /*	z-index: 100;*/
            /*	margin-top: 190px;*/
            position: relative;
        }

        .contentList {
            margin-top: 108px;
            /*background-color: red;*/
        }

        .mui-table-view-cell {
            position: relative;
            overflow: hidden;
            padding: 10px 0px;
            -webkit-touch-callout: none;
        }

        .title_style_color {
            background-color: #36353A
        }

        .base_user_icon {
            height: 24px;
            position: absolute;
            top: 50%;
            right: 10px;
            margin-top: -13px;
        }

        .div_style_top {
            margin-top: 7px;
            padding: 0 10px;
            background-color: #FFFFFF;
        }

        .img_width {
            width: 20px;
            position: relative;
            top: 2px;
        }

        .img_background-image {
            display: block;
            background-image: url(image/course_placehoder.png);
            background-size: 30vw 100%;
            border: 1px solid #fff;
            border-radius: 4px;
        }

        .left10 {
            padding-left: 10px;
        }

        .right10 {
            padding-right: 10px;
        }

        .div_div_left {
            margin-bottom: 5px;
            float: left;
            width: 23%;
            border: 1px solid #ededed;
            border-radius: 6px;
            text-align: center;
            padding-top: 10px;
        }

        .div_div_left4 {
            float: left;
            width: 2.5%;
            color: #FFFFFF
        }

        .img_user_paic {
            width: 44px;
            height: 44px;
            border-radius: 20px;
        }

        .rotation-img {
            width: 100%;
            height: 56vw;
            background-image: url(image/course_placehoder.png);
            background-size: 100% 100%;
            display: block;
            object-fit: cover;
        }

        .mui-slider-indicator .mui-indicator {
            background-color: #e6e3e3;
        }

        .padding0 {
            padding-left: 0px;
            padding-right: 0px;
        }

        .redPointMessagetitle {
            width: 8px;
            height: 8px;
            top: 6px;
            right: 6px;
        }

        .font13 {
            font-size: 13px;
        }

        .padding_left5 {
            padding-left: 5px;
        }

        /**默认显示4行*/
        .according-2-rows {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 4;
            -webkit-box-orient: vertical;
        }

        .chat_item {
            width: 44px;
            height: 44px;
            position: absolute;
            right: 44px;
            top: 0;
        }

        .signImgDiv {
            background: url(image/sign_background.png);
            background-size: 100% 100%;
            height: 84px;
        }

        .signCloseImg {
            width: 18px;
            position: relative;
            top: 5px;
            float: right;
            right: 10px
        }

        .signbtn1 {
            padding-bottom: 0.2rem;
            font-size: 0.875rem;
            width: 4.625rem;
            height: 1.5rem;
            line-height: 1.5rem;
            border-radius: 0.375rem;
            background-color: #727dce;
            text-align: center;
            position: absolute;
            left: 50%;
            bottom: 5.86%;
            margin-left: -2.5rem;
            color: #FFFFFF;
        }

        .signbtn2 {
            padding-bottom: 0.2rem;
            font-size: 0.875rem;
            width: 4.625rem;
            height: 1.5rem;
            line-height: 1.5rem;
            border-radius: 0.375rem;
            background-color: rgb(204, 204, 204);
            text-align: center;
            position: absolute;
            left: 50%;
            bottom: 5.86%;
            margin-left: -2.5rem;
            color: #FFFFFF;
        }

        .base_right_reddiv {
            top: 7px;
            left: 30px;
        }

        .div_mengceng_hongdong {
            background-color: #000000;
            width: 100%;
            height: 100%;
            position: fixed;
            opacity: 0.6;
            top: 66px;
            z-index: 2;
        }

        .div_mengceng_img {
            width: 100%;
            padding-left: 40px;
            padding-right: 40px;
            padding-top: 80px;
            position: fixed;
            top: 66px;
            z-index: 3;
        }

        .div_mengceng_img_botton {
            width: 120px;
            position: fixed;
            z-index: 4;
            bottom: 20%;
            right: 34%;
        }

        .div_mengceng_close {
            width: 26px;
            position: fixed;
            z-index: 4;
            right: 10px;
            top: 110px;
        }

        .dayiImgDiv {
            /* background: url(image/icon_dayi02.png);*/
            background-size: 100% 100%;
            height: 20vw;
            /*		margin-bottom: 10px;
                    margin-top: 10px;*/
        }

        #div_message_img {
            margin-left: 20px;
            max-width: 70px;
            height: 46px;
        }

        .div_message_dian {
            width: 2px;
            height: 2px;
            background-color: #000000;
            position: relative;
            border-radius: 50%;
            top: 8px;
        }

        .mui-navigate-right:after, .mui-push-left:after, .mui-push-right:after {
            font-size: 18px;
        }

        .left_5_right_5 {
            margin-left: 5px;
            margin-right: 5px;
            width: 95%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mui-table-view-chevron .mui-table-view-cell {
            padding-right: 35px;
        }

        .mui-table-view-chevron .mui-table-view-cell > a:not(.mui-btn) {
            margin-right: -35px;
        }

        .top_8 {
            margin-top: 8px;
        }

        .suspension-window {
            position: fixed;
            z-index: 200;
            top: 200px;
            right: 0;
        }

        .suspension-img {
            border-radius: 35px;
            width: 70px;
            height: 70px;
            display: block;
        }

        .base_add_icon {
            height: 22px;
            float: right;
            margin-right: 15px;


        }

        .change-net-win {
            background-color: rgba(80, 150, 150, 0.5);
            text-align: center;
            color: white;
            font-size: 16px;
            line-height: 50px;
            border-radius: 25px;
            width: 50px;
            height: 50px;
        }

        /*#publicRing:after{*/
        /*    right: 15px;*/
        /*    background-color: red;*/
        /*    background-image:url("image/calendar_arrow_right.png");*/
        /*}*/
    </style>
</head>
<body>


<div id="navigationBar" class="base_navigation_bar title_style_color base_navigation_item_bar">
    <a class="base_left_item" href="#" onclick="openwin(10)"> <img style="margin: 0px" class="base_back_icon"
                                                                   src="image/icon_my.png"
                                                                   alt="">
        <!--<div id="redPoint_div1" class="redPointMessage base_right_reddiv" ></div> -->
    </a>
    <span id="newsTitle" style="line-height: normal">长风网</span>
    <a class="base_right_item nav-item" href="#" onclick="openCamera()" id="scan_div"> <img class="base_add_icon"
                                                                                            src="image/icon_scan.png"
                                                                                            alt=""> </a>
    <!--	<a class="base_right_item" onclick="toMessageClick()"><div id="redPoint_xuexi_div" class="redPointMessage redPointMessagetitle" ></div> <img class="base_user_icon" src="image/icon_message.png" alt=""> </a>-->
    <!-- <a id="chat_btn" class="chat_item" onclick="toChatClick()" hidden="hidden">
        <div id="redPoint_teacher_group" class="redPointMessage redPointMessagetitle" hidden="hidden"></div>
        <img class="base_user_icon" src="image/icon_teacher_group.png" alt="">
    </a> -->
</div>
<div id="wrap" hidden="hidden">
    <!-- 轮播图 -->
    <div id="train_slider" class="mui-slider rotation-div">
        <div id="rotation" class="mui-slider-group mui-slider-loop">
            <!--<div class="mui-slider-item mui-slider-item-duplicate">
               <a href="#">
                   <img class="rotation-img" src="image/course_placehoder.png">
               </a>
           </div>
           <div class="mui-slider-item">
               <a href="#">
                   <img class="rotation-img" src="image/course_placehoder.png">
               </a>
           </div>
           <div class="mui-slider-item mui-slider-item-duplicate">
               <a href="#">
                   <img class="rotation-img" src="image/course_placehoder.png">
               </a>
           </div> -->
        </div>

        <div id="noRotation" hidden="hidden">
            <div class="rotation-cell">
                <a href="#" style=" display: block;">
                    <img class="rotation-img" src="image/firstNewsTitls2.png">
                </a>
            </div>
        </div>
        <div id="pageControl" class="mui-slider-indicator">
            <!-- <div class="mui-indicator mui-active"></div> -->
        </div>
    </div>

    <div style="background-color: white;height: 100px;">
        <div class="functionButton" id="studentFunction">
            <span class="iconFrame" onclick="openwin(1)">
				<div style="position:relative;">
				<!--	<div id="redPoint_xuexi" class="redPointMessage" style="right: 20px;top: 3px;"></div>-->
				<img id="icon_xuexi" class="imgSet" src="./image/icon_xuexi.png" alt=""></img>
				</div>
				<div class="btnFrame">
				<span class="base_content_font base_black_grey">学习</span>
				</div>
           </span>
            <span class="iconFrame" onclick="openwin(2)">
				<div>
				<img class="imgSet" src="./image/icon_shixi.png" alt=""></img>
				</div>
				<div class="btnFrame">
				<span class="base_content_font base_black_grey">实习</span>
				</div>
           </span>
            <span class="iconFrame" onclick="openwin(3)">
           	<div>
                <img class="imgSet" src="./image/icon_renzheng.png" alt=""></img>
           	</div>
           	<div class="btnFrame">
           		<span class="base_content_font base_black_grey">认证</span>
           	</div>
           </span>
            <span class="iconFrame" onclick="openwin(4)">
           	<div>
           		<img class="imgSet" src="./image/icon_jingsai.png" alt=""></img>
           	</div>
           	<div class="btnFrame">
           		<span class="base_content_font base_black_grey">竞赛</span>
           	</div>
           </span>
            <span class="iconFrame" onclick="openwin(9)">
           	<div>
           		<img class="imgSet" src="./image/icon_ketang.png" alt=""></img>
           	</div>
           	<div class="btnFrame">
           		<span class="base_content_font base_black_grey">课程</span>
           	</div>
           </span>
        </div>
        <div class="functionButton" id="teacherFunction" hidden="hidden">
            <span class="iconFrame" onclick="openwin(5)">
            <div style="position:relative;">
           <!-- <div id="redPoint_jiaoxue" class="redPointMessage" style="right: 20px;top: 3px;"></div> -->
              	 <img id="icon_jiaoxue" class="imgSet" src="./image/icon_jiaoxue.png" alt=""></img>
            </div>
            <div class="btnFrame">
            	<span class="base_content_font base_black_grey">教学</span>
            </div>
           	</span>
            <span class="iconFrame" onclick="openwin(6)">
             <div>
               <img class="imgSet" src="./image/icon_shixi.png" alt=""></img>
             </div>
             <div class="btnFrame">
               <span class="base_content_font base_black_grey">实习</span>
             </div>
           </span>
            <span class="iconFrame" onclick="openwin(7)">
             <div>
               <img class="imgSet" src="./image/icon_peixun.png" alt=""></img>
             </div>
             <div class="btnFrame">
               <span class="base_content_font base_black_grey">培训</span>
             </div>
           </span>
            <span class="iconFrame" onclick="openwin(8)">
             <div>
               <img class="imgSet" src="./image/icon_jingsai.png" alt=""></img>
             </div>
             <div class="btnFrame">
               <span class="base_content_font base_black_grey">竞赛</span>
             </div>
           </span>
            <span class="iconFrame" onclick="openwin(9)">
             <div>
               <img class="imgSet" src="./image/icon_ketang.png" alt=""></img>
             </div>
             <div class="btnFrame">
               <span class="base_content_font base_black_grey">课程</span>
             </div>

           </span>
            <!--			<span class="iconFrame" onclick="openwin(100)">-->
            <!--             <div >-->
            <!--               <img class="imgSet" src="./image/icon_ketang.png" alt=""></img>-->
            <!--             </div>-->
            <!--             <div class="btnFrame">-->
            <!--               <span class="base_content_font base_black_grey">直播</span>-->
            <!--             </div>-->
            <!--           </span>-->
        </div>
    </div>
    <!--  活动页-->
    <!-- <div class="" id="sign" style="position: relative; display: none"  onclick="SignDivClick()">
		<div  class="signImgDiv">
			<img src="image/sign_close.png"  class="signCloseImg"  onclick="closeSignDiv()"/>
		<div class="signbtn1"  style="display: none" onclick="UserCompetitionSign()">点击签到</div>
			<div class="signbtn2" style="display: none">已签到</div>
		</div>
	</div> -->
    <div onclick="chartGroup()"
         style="position: relative;line-height:3.5rem;height: 3.5rem;background-color: white;margin-top: 10px">
        <img style="margin-left: 20px;width: 18px;height: 18px;position: absolute;top: 50%;transform: translate(-50%,-50%)"
             src="icon/ring_icon.png"/>
        <span style="color: #676767;font-size: 14px;margin-left: 35px">互动圈子</span>
        <span style="float: right;margin-right:30px;color: #555555;font-size: 12px">当前讨论数:<span id="publicRing"
                                                                                                style="color: #EA3F3E">999</span></span>
        <img src="image/calendar_arrow_right.png"
             style="position:absolute;right:10px;width: 6px;top: 50%;transform: translate(-50%,-60%)"/>
    </div>
    <ul class="mui-table-view mui-table-view-chevron base_grey base_content_font top_8" id="massageUl"
        onclick="toMessageClick()" hidden="hidden">
        <li id="qiandao" class="mui-table-view-cell mui-media">
            <a class='mui-navigate-right' href="javascript:;"> <img id="div_message_img"
                                                                    class="mui-media-object mui-pull-left "
                                                                    src="image/incon_message.png">
                <div class="mui-media-body" id="massageDiv">
                    <!--<div class="base_black_grey  base_content_font">
                            <div class="div_message_dian left"></div><span class="left_5_right_5 base_black_grey ">老师已经批阅作业老师已经批阅作业老师已经批阅作业老师已经批阅作业老师已经批阅作业</span>
                            <span class="base_grey base_tag_font"> 1小时前</span>
                        </div>
                        <div class="base_black_grey  base_content_font">
                            <div class="div_message_dian left"></div><span class="left_5_right_5 base_black_grey ">老师已经批阅作业</span>
                            <span class="base_grey base_tag_font"> 1小时前</span>
                        </div>-->

                </div>
            </a>
        </li>
    </ul>
    <!--广告位置-->
    <div id="dayi" style="position: relative; display: none;" onclick="dayiDivClick()" class="top_8">
        <div id="hdongDiv" class="dayiImgDiv">
        </div>
    </div>
    <div style="height: 8px;width: 100%;  background-color: #f3f5f7;"></div>

    <div class="div_style_top">
        <div style=" line-height: 40px;">
            <img src="image/icon_course.png" class="img_width"/><samp id="course_top_title"
                                                                      class="base_tag_font_tag base_content_font padding_left5">热门课程</samp>
            <span class="right  base_dark_grey_shallow base_tag_font" onclick='openSelectCourseWin()'>更多 </span>
        </div>
        <div class="clearfix" id="div_mooc">

        </div>
    </div>
    <div style="padding-right: 10px;padding-left: 10px;line-height: 40px;background-color: #ffffff">
        <img src="image/icon_ews.png" class="img_width"/><samp
            class="base_tag_font_tag base_content_font padding_left5" >热门资讯</samp>
        <span id="more_news" class="right base_dark_grey_shallow base_tag_font" onclick='openMoreNews()'
              hidden="hidden">更多</span>
    </div>
    <ul class="mui-table-view" id="div_zixun">
        <!--<li class="mui-table-view-cell train-cell">
                <img class="hot-train-image" src="../../image/course_placehoder.png">
                <div class="hot-train-title-div">
                    <p class="base_black_grey base_content_font train-title">
                        就业推荐 汇聚各路英才
                        就业推荐 汇聚各路英才
                        就业推荐 汇聚各路英才
                        就业推荐 汇聚各路英才
                    </p>
                    <p class="base_grey base_tag_font hot-train-time">
                        2017-09-10
                    </p>
                </div>
            </li>
            <li class="mui-table-view-cell train-cell">
                <img class="hot-train-image" src="../../image/course_placehoder.png">
                <div class="hot-train-title-div">
                    <p class="base_black_grey base_content_font train-title">
                        就业推荐 汇聚各路英才
                        就业推荐 汇聚各路英才
                        就业推荐 汇聚各路英才
                        就业推荐 汇聚各路英才
                    </p>
                    <p class="base_grey base_tag_font hot-train-time">
                        2017-09-10
                    </p>
                </div>
            </li> -->
    </ul>
    <div class="div_style_top" id="job" hidden="hidden">
        <div style=" line-height: 40px;">
            <img src="image/icon_job.png" class="img_width"/><samp
                class="base_tag_font_tag base_content_font padding_left5">推荐岗位</samp>
            <span class="right  base_dark_grey_shallow base_tag_font" onclick='openwin(11)'>更多 </span>
        </div>
        <div class="clearfix" id="div_jobs">
        </div>
    </div>
    <div class="div_style_top ">
        <div style=" line-height: 40px;">
            <img src="image/icon_cfntxing.png" class="img_width"/><samp
                class="base_tag_font_tag base_content_font padding_left5">长风英才</samp>
        </div>
        <div class="clearfix" id="div_users">
            <!--<div  class= "div_div_left  " >
                <img src="image/icontaoxing1.png"  class="img_user_paic"/>
                <p class="base_dark_grey base_tag_font">
                    李前
                </p>
            </div>
            <div  class= "div_div_left4 ">
                11
            </div>
            <div  class= "div_div_left " >
                <img src="image/icon_teacher_normal.png"  class="img_user_paic"/>
                <p class="base_dark_grey base_tag_font">
                    欧阳雪
                </p>
            </div>
            <div  class= "div_div_left4 ">
                11
            </div>
            <div  class= "div_div_left " >
                <img src="image/icontaoxing2.png"  class="img_user_paic"/>
                <p class="base_dark_grey base_tag_font">
                    赵旗
                </p>
            </div>
            <div  class= "div_div_left4 ">
                11
            </div>
            <div  class= "div_div_left " >
                <img src="image/icontaoxing3.png"  class="img_user_paic"/>
                <p class="base_dark_grey base_tag_font">
                    王丽华
                </p>
            </div>-->
        </div>
    </div>
    <ul class="mui-table-view" id="div_cfnetnews">
        <!--		<li class="mui-table-view-cell">
                    <p class="item_text_title base_content_font base_black_grey" >
                        第五十三期长风讲师培训班在柳州成功举办
                    </p>
                    <p class="item_text_bz base_grey base_tag_font">
                        2017-9-10
                    </p>
                </li>-->
    </ul>
</div>
<div class="noSign" id="noData" hidden="hidden">
    <img src="./image/icon_nodata.png" width="60%">
    <p class="font16 top_15 base_dark_grey">
        暂无数据
    </p>
</div>
<div class="loadFailure" hidden="hidden" id="noNet">
    <img src="./image/icon_nonet.png" width="60%">
    <p class="">
        数据加载失败
    </p>
    <p>
        请检查您的网络
    </p>
    <button type="button" class="mui-btn mui-btn-outlined" onclick="loaddata()">
        重新加载
    </button>
</div>
<!--活动页-->
<div id="mengcengDiv" hidden="hidden">
    <div class="div_mengceng_hongdong"></div>
    <img src="icon/close_discuss.png" class="div_mengceng_close" onclick="closehongdong()"/>
    <img id="div_mengceng_img" class="div_mengceng_img" onclick="hongdongOpnewin()"/>
</div>
<div id="suspension_win" class="suspension-window" hidden="hidden" onclick="toCFClassClick();">
    <img src="image/icon_cfclass.png" class="suspension-img">
</div>
<div id="change_net_win" class="suspension-window change-net-win" hidden="hidden" onclick="toChangeNetStatus();">
    正式服
</div>
</body>
<script type="text/javascript" src="script/api.js"></script>
<script type="text/javascript" src="script/jquery.min.js"></script>
<script type="text/javascript" src="script/databaseOperation.js"></script>
<script type="text/javascript" src="script/downloadManager.js"></script>
<script type="text/javascript" src="script/mui.min.js"></script>
<script type="text/javascript" src="script/MD5.js"></script>
<script type="text/javascript" src="script/requestTool.js"></script>
<script type="text/javascript" src="script/freeCourseRecord.js"></script>
<script type="text/javascript" src="script/push.js"></script>
<script type="text/javascript" src="script/common.js"></script>
<script type="text/javascript" src="script/buriedPoint.js"></script>
<script type="text/javascript" src="script/qrode_common.js"></script>
<script type="text/javascript" src="script/base64.min.js"></script>
<script type="text/javascript" src="script/manager/windowManager.js"></script>
<script type="text/javascript" src="script/WebNotification.js"></script>
<script type="text/javascript" src="script/permission.js"></script>
<script type="text/javascript" src="script/chat_audio_survey.js"></script>
<script type="text/javascript">
    var rotationArr = new Array();//轮播图数据
    var clic = false;
    var page = "";
    var rows = "";
    var stdydata = [];//学习集团下的数组
    var certificatiodata = [];//实习
    var zixun_data = [];//资讯数组
    var mooc_data = [];//慕课数组
    var job_data = [];//岗位数组
    var dipper_data = [];//长风英才数组
    var dipperzixun_data = [];//长风英才资讯数组
    var action_data = new Array();//活动说明数据
    var advert_data = new Array();//广告数组
    var type = '0';
    var usertype = '';
    var aid = ''//报名id
    var jid = '';
    var permissonList = ['camera', 'storage', 'location'];
    DBReady = function () {
        console.log("所有window:" + JSON.stringify(api.windows()));
        initHeaderUI();
        $('#wrap').css('padding-top', $('#navigationBar').innerHeight());
        checkPermission(['storage'], function (ret) {
            if (!ret) {
                api.alert({
                    title: '警告',
                    msg: '存储权限申请失败，应用无法正常使用，请到系统设置中打开存储权限'
                }, function (ret, err) {
                    api.closeWidget({
                        "silent": true
                    });
                });
            }
        });
        register();
        getUserRingInfo();//获取用户环信信息
        getPublicNumber();//获取公共圈子数
        startServey();
        //设置服务器切换
        setupNetStatus();
        //初始化推送
        initpush();
        //绑定账号
        loginSucceedPush();
        //读取历史未读消息
        // updateMessageStatus();
        //设置屏幕状态
        setupScreen();
        //准备数据
        prepareData();
        //准备数据库
        prepareDB();
        //打开下载通知
        openDownloadManagerNotifi();
        //准备自由课程记录上传通知
        prepareFreeCourseRecordNotifi();
        //设置安卓返回按钮点击事件
        setupKeyBackNotifi();
        //设置通知
        setupNotifi();
        // loadMessageData();
        //设置未来课堂悬浮窗
        setupCFClassFrame();
    }

    function getUserRingInfo() {
        cfnetppPOST(url_ring_register, {uid: $api.getStorage('cfnetppuid')}, false, function (data, status) {
            if (data.status) {
                var easeChat = api.require('easeChat');
                easeChat.logout(function (ret, err) {
                });
                $api.setStorage('cfRingUsername', data.data.username);
                $api.setStorage('cfRingPassword', data.data.password);
                $api.setStorage('cfnetringid', data.data.username);
            }
        });
    }

    function getPublicNumber() {
        cfnetppPOST(url_ring_publicNumber,{}, false, function (data, status) {
            if (data.status) {
                var count = data.data.count;
                if (count >= 1000) {
                    $('#publicRing').text(parseInt(count / 1000) + "k");
                } else {
                    $('#publicRing').text(count);
                }
            }
        })
    }

    function setupNetStatus() {
        if ($api.getStorage('cfnetppuid') == '30412') {
            setupModel($('#change_net_win'));
            var netStatus = $api.getStorage('app_net_status');
            if (netStatus != undefined && netStatus != null) {
                if (netStatus == '1') {
                    $('#change_net_win').text('正式服');
                } else {
                    $('#change_net_win').text('测试服');
                }
            } else {
                $('#change_net_win').text('正式服');
            }
            $('#change_net_win').show();
        }
    }

    function openCamera() {
        checkPermission(['camera'], function (ret) {
            if (!ret) {
                api.alert({
                    title: '警告',
                    msg: '相机权限申请失败，该功能无法使用，请到系统设置中打开相机权限'
                }, function (ret, err) {

                });
            } else {
                openQrcod();
            }
        });
    }

    function setupModel(model) {
        // var cont = $('suspension_win');
        // var contW = $('#suspension_win').width();
        // var contH = $('#suspension_win').height();
        var cont = model;
        var contW = model.width();
        var contH = model.height();
        var startX, startY, sX, sY, moveX, moveY, leftX, rightX, topY, bottomY;
        var winW = $(window).width();
        var winH = $(window).height();
        cont.on({//绑定事件
            touchstart: function (e) {
                //获取点击的坐标X
                startX = e.originalEvent.targetTouches[0].pageX;
                //获取点击的坐标Y
                startY = e.originalEvent.targetTouches[0].pageY;
                //相对于当前窗口X轴的偏移量
                sX = $(this).offset().left;
                //相对于当前窗口Y轴的偏移量
                sY = $(this).offset().top;
                //鼠标所能移动的最左端
                leftX = startX - sX;
                //鼠标所有移动的最右端
                rightX = winW - contW + leftX;
                //鼠标所能移动的最上端
                topY = startY - sY;
                //鼠标所能移动的最底部
                bottomY = winH - contH + topY;
            },
            touchmove: function (e) {
                e.preventDefault();
                //移动过程中的X轴坐标
                moveX = e.originalEvent.targetTouches[0].pageX;
                //移动过程中的Y轴坐标
                moveY = e.originalEvent.targetTouches[0].pageY;
                if (moveX < leftX) {
                    moveX = leftX;
                }
                if (moveX > rightX) {
                    moveX = rightX;
                }
                if (moveY < topY) {
                    moveY = topY;
                }
                if (moveY > bottomY) {
                    moveY = bottomY;
                }
                $(this).css({
                    'left': moveX + sX - startX,
                    'top': moveY + sY - startY
                });
            }
        });
    }

    //准备数据
    function prepareData() {
        jid = $api.getStorage('cfnetppjxid');
        if (jid == "" || jid == null || jid == undefined) {//判断是否有jid
            getjituanArr();
        } else {
            stdydata = $api.getStorage('stdydata');//学习集团下的数组
            certificatiodata = $api.getStorage('practicedata'); //实习
            slecttype();
        }
    }

    //设置屏幕状态
    function setupScreen() {
        //取消全屏即显示状态栏
        api.setFullScreen({
            fullScreen: false
        });
        //设置软件方向为垂直向上切不随屏幕旋转
        api.setScreenOrientation({
            orientation: "portrait_up"
        });
        //设置状态栏字体颜色为白色
        api.setStatusBarStyle({
            style: 'light'
        });
    }

    //所有的通知
    function setupNotifi() {
        //屏幕即将显示首页
        api.addEventListener({
            name: 'viewappear'
        }, function (ret, err) {
            if ($api.getStorage('tempjid') != undefined) {
                $api.setStorage('cfnetppjxid', $api.getStorage('tempjid'));
            }
            $api.setStorage('cfnetlanxueoldjid', '');//置空蓝血计划教学id
        });
        api.addEventListener({
            name: 'updateUserNotice'
        }, function (ret, err) {
            //更新首页通知消息
            loadMessageData();
        });
        //切换教学集团通知
        api.addEventListener({
            name: 'changeJxjidNotifi'
        }, function (ret, err) {
            jid = $api.getStorage('cfnetppjxid');
            if (ret.value.isJump) {
                switch (ret.value.jumpTo) {
                    case "circle":
                        chartGroup();
                        break;
                    case "learnplan":
                        openwin(1);
                        break;
                }

            }
        });
        //新消息推送通知红点提示
        api.addEventListener({
            name: 'pushMessage_index'
        }, function (ret, err) {
            loadMessageData();
        });
        //取消红点, 点击课程里面的消息之后取消外面的红点
        api.addEventListener({
            name: 'click_pushMessage_index'
        }, function (ret, err) {
            //读取接口未读消息
            loadMessageData();
        });
        //取消红点, 点击课程里面的消息之后取消外面的红点
        api.addEventListener({
            name: 'click_pushMessage_classromm_index'
        }, function (ret, err) {
        });
        //切换集团之后更新首页
        api.addEventListener({
            name: 'changeJidNotifi'
        }, function (ret, err) {
            if (ret) {
                slecttype();
                //绑定学生或者教师身份标签
                //bindTeacherOrStudent();
                //切换集团读取历史未读消息
                // updateMessageStatus();
                //读取历史消息
                // pushMessage();
                //读取是否有新消息
                loadMessageData();
            }
        });
        //监听老师群组是否有新的消息
        api.addEventListener({
            name: 'RongCloudTeacherGroupNewMessageNotifi'
        }, function (ret, err) {
            if (ret.value.status == 1) {//有新消息
                $('#redPoint_teacher_group').show();
            } else {
                $('#redPoint_teacher_group').hide();
            }
        });
        //云修复完成
        api.addEventListener({
            name: 'smartupdatefinish'
        }, function (ret, err) {
            //重启app
            api.rebootApp();
        });
        //添加课程资源信息
        api.addEventListener({
            name: 'AddChapterInformation'
        }, function (ret, err) {
            var dataInformation = ret.value;
            if (dataInformation) {
                AddChapterInformation(dataInformation.pid, dataInformation.cid, dataInformation.vid);
            }
        });
        //埋点接受通知
        buriedPointReceNotifi();
    }

    //准备创建表
    function prepareDB() {
        dropTables(function () {
            createTables(function (ret) {
            });
        });
    }

    //设置安卓返回按钮点击事件
    function setupKeyBackNotifi() {
        //安卓下按2返回键退出
        var currentClickNum = 0;
        api.addEventListener({
            name: 'keyback'
        }, function (ret, err) {
            currentClickNum++;
            //提示
            api.toast({
                msg: '再按一次返回键退出' + api.appName,
                duration: 2000,
                location: 'bottom'
            });
            //3秒内不退出重置提示。
            setTimeout(function () {
                currentClickNum = 0;
            }, 3000)
            if (currentClickNum == 2) {
                api.closeWidget({
                    id: 'A6947555569146',
                    retData: {
                        name: 'closeWidget'
                    },
                    animation: {
                        type: 'flip',
                        subType: 'form_bottom',
                        duration: 500
                    },
                    silent: true
                });
            }
        });
    }

    //消息
    function toMessageClick() {
        console.log(type);
        if (type == 0) {//学生
            api.openWin({useWKWebView:true,
                name: 'Student_MessageWin',
                url: 'html/Study/Student_MessageWin.html',
                pageParam: {
                    sourceurl: window.location.pathname,
                    sourcetitle: document.title
                }
            });
        } else if (type == 1) {//老师
            api.openWin({useWKWebView:true,
                name: 'Teacher_ToDoMessageWin',
                url: 'html/Teacher_Teach/Teacher_ToDoMessageWin.html',
                pageParam: {
                    sourceurl: window.location.pathname,
                    sourcetitle: document.title
                }
            });
        } else if (type == 2) {//企业师傅
            api.openWin({useWKWebView:true,
                name: 'Teacher_ToDoMessageWin',
                url: 'html/Practice_Master/Master_ToDoMessageWin.html',
                pageParam: {
                    sourceurl: window.location.pathname,
                    sourcetitle: document.title
                }
            });
        } else {
            api.openWin({useWKWebView:true,
                name: 'Student_MessageWin',
                url: 'html/Study/Student_MessageWin.html',
                pageParam: {
                    sourceurl: window.location.pathname,
                    sourcetitle: document.title
                }
            });
        }
    }

    //加载数据
    function loaddata() {
        showProgress();
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            newstype: usertype,
            jid: jid
        };
        // console.log(JSON.stringify(params)+'\n'+url_getTecherFirstIndex);
        cfnetppPOST(url_getTecherFirstIndex, params, true, function (data, status) {
            api.hideProgress();
            if (status == 'success') {
                if (data.code == 200) {
                    $('#wrap').show();
                    $('#noData').hide();
                    $('#noNet').hide();
                    var Tecdata = data.data;
                    rotationArr = Tecdata.shouye;
                    console.log(JSON.stringify(rotationArr));
                    setupRotationData();
                    zixun_data = Tecdata.zixun;
                    news(zixun_data, zixun_data.length);
                    mooc_data = Tecdata.pubcourse;
                    moocs(mooc_data, mooc_data.length);
                    dipper_data = Tecdata.dipper;
                    dipperzixun_data = Tecdata.dipperzixun;
                    cfnetuser(dipper_data, dipper_data.length);
                    cfnetnews(dipperzixun_data, dipperzixun_data.length);
                    if (Tecdata.action != undefined && Tecdata.advert != undefined) {
                        action_data = Tecdata.action;//活动说明数据
                        advert_data = Tecdata.advert;//广告数组
                        isShowHongdong();
                    }
                    if ($api.getStorage('cfnetSelectType') == 0) {
                        job_data = Tecdata.jobs;
                        jobs(job_data, job_data.length);
                    }
                } else {
                    $('#wrap').hide();
                    $('#noData').show();
                    $('#noNet').hide();
                }
            } else {
                $('#wrap').hide();
                $('#noData').hide();
                $('#noNet').show();
            }
        });
    }

    function openMoreNews() {
        api.openWin({useWKWebView:true,
            name: 'hotNews_Win',
            url: 'hotNews_Win.html',
            pageParam: {
                newsArr: zixun_data
            }
        });
    }

    function news(datas, len) {
        var news = '';
        if (len > 4) {//当资讯大于4条时
            len = 4;
            $('#more_news').show();
        }
        for (var i = 0; i < len; i++) {
            var data = datas[i];
            var imgPath = data.image;
            if (imgPath != null && imgPath != "") {
                var newhtml = '<li class="mui-table-view-cell train-cell" style="padding-right: 10px;padding-left: 10px" onclick="CheckZixunClick(' + i + ')">' +
                    '<img class="hot-train-image" src="' + imgPath + '">' +
                    '<div class="hot-train-title-div">' +
                    '<p class="base_black_grey base_content_font train-title">'
                    + data.cname +
                    '</p>' +
                    '<p class="base_grey base_tag_font hot-train-time">' +
                    getCurrentDay(data.instime) + '&nbsp;&nbsp;' + '长风网' +
                    '</p>' +
                    '</div>' +
                    '</li>';
            } else {
                var newhtml = '<li class="mui-table-view-cell " style="padding-right: 10px;padding-left: 10px"><p class="item_text_title base_content_font base_black_grey according-2-rows" >' + escape2Html(data.cname).replace(/&/g, '') + '</p>' +
                    //				        '<p class="item_text_bz base_grey base_tag_font">'+getCurrentDay(data.ctime)+data.author+'&nbsp;&nbsp;'+'</p>'+
                    '</div>' +
                    '</li>';
            }
            news = news + newhtml;
        }
        $("#div_zixun").html(news);
    }

    //公开课
    function moocs(datas, len) {
        var moocs = '';
        for (var i = 0; i < len; i++) {
            var data = datas[i];
            var div = '';
            if (i == 0 || i == 2) {
                div = '<div  class= "div_img_left clearfix right10" onclick="CheckMoocClick(' + i + ')">';
            } else {
                div = '<div  class= "div_img_left left10" onclick="CheckMoocClick(' + i + ')">';
            }
            var mooc = div + '<img  src="' + data.image + '" class="td_left img_background-image" onerror="Imgnofind()"/>' + '<p   class="base_content_font base_black_grey padding_left_right5">'
                + data.cname + '</p>' + '</div>';
            moocs = moocs + mooc;
        }
        $('#div_mooc').html(moocs);
    }

    //岗位
    function jobs(datas, len) {
        var jobs = '';
        for (var i = 0; i < len; i++) {
            var data = datas[i];
            var div = '';
            if (i == 0 || i == 2) {
                div = '<div  class= "div_img_left right10" onclick="CheckJobClick(' + i + ')">';
            } else {
                div = '<div  class= "div_img_left left10" onclick="CheckJobClick(' + i + ')">';
            }
            var job = div +
                '<img   src="' + data.img + '" class="td_left img_background-image" onerror="Imgnofind()"/>' + '<p   class="base_content_font base_black_grey padding_left_right5">' +
                data.quarter +
                '</p>' +
                '</div>';
            jobs = jobs + job;
        }
        $('#div_jobs').html(jobs);
    }

    //长风之星
    function cfnetuser(datas, len) {
        var users = '';
        for (var i = 0; i < len; i++) {
            var data = datas[i];
            var divs = '';
            if (i != 3) {
                divs = '<div class= "div_div_left4 ">11</div>';
            }
            var user = '<div class= "div_div_left" onclick="CheckCfntUserClick(' + i + ')">' +
                '<img src="' + data.pic + '"  class="img_user_paic"/>' +
                '<p class="base_dark_grey base_content_font">' +
                data.name +
                '</p></div>' + divs;
            users = users + user;
        }
        $('#div_users').html(users);
    }

    //长风之星新闻
    function cfnetnews(datas, len) {
        var newhtmls = '';
        for (var i = 0; i < len; i++) {
            var data = datas[i];
            var newhtml = '<li class="mui-table-view-cell " style="padding-right: 10px;padding-left: 10px" onclick="CheckCfntZixunClick(' + i + ')"><p class="item_text_title base_content_font base_black_grey according-2-rows" >' + escape2Html(data.cname).replace(/&/g, '') + '</p>' +
                '<p class="item_text_bz base_grey base_tag_font">' + getCurrentDay(data.instime) + '&nbsp;&nbsp;' + '长风英才' + '</p>' +
                '</div>' +
                '</li>';
            newhtmls = newhtmls + newhtml;
        }
        $('#div_cfnetnews').html(newhtmls);
    }

    //设置轮播图数据
    function setupRotationData() {
        if (rotationArr == null || rotationArr.constructor != Array || rotationArr.length == 0) {
            return;
        }
        if (rotationArr.length == 1) {
            var rotationHtml = '';
            rotationHtml = noRotationHtmlString(0, rotationArr[0]);
            $('#noRotation').html(rotationHtml);
            $('#noRotation').show();
            $('#rotation').hide();
        } else {//轮播图数据大于1条时
            var rotationHtml = '';
            //额外增加的一个节点(循环轮播：第一个节点是最后一张轮播)
            var lastIndex = rotationArr.length - 1;
            var rotationLastData = rotationArr[lastIndex];
            rotationHtml += firstLastImgHtml(lastIndex, rotationLastData);
            //遍历数组
            for (var i = 0; i < rotationArr.length; i++) {
                var rotationData = rotationArr[i];
                rotationHtml += rotationHtmlString(i, rotationData);
            }
            //额外增加的一个节点(循环轮播：最后一个节点是第一张轮播)
            var firstIndex = 0;
            var rotationFirstData = rotationArr[firstIndex];
            rotationHtml += firstLastImgHtml(firstIndex, rotationFirstData);
            $('#noRotation').hide();
            $('#rotation').show();
            //设置轮播图代码
            $('#rotation').html(rotationHtml);
            //设置page Control
            $('#pageControl').html(pageControlHtml(rotationArr.length));
            //设置自动轮播
            setupAutoRotation();
        }
        //设置轮播图点击事件
        setupRotationCellClick();
    }

    function setupAutoRotation() {
        var slider = mui("#train_slider");
        slider.slider({
            interval: 3000
        });
    }

    //分页html
    function pageControlHtml(count) {
        var pageControl = '';
        pageControl += '<div class="mui-indicator mui-active"></div>';
        for (var i = 1; i < count; i++) {
            pageControl += '<div class="mui-indicator"></div>';
        }
        return pageControl;
    }

    //轮播图首尾
    function firstLastImgHtml(index, data) {
        return '<div index="' + index + '" class="rotation-cell mui-slider-item mui-slider-item-duplicate">' +
            '<a href="#">' +
            '<img class="rotation-img" src="' + data.image + '">' +
            '</a>' +
            '</div>';
    }

    //轮播图
    function rotationHtmlString(index, data) {
        return '<div index="' + index + '" class="rotation-cell mui-slider-item">' +
            '<a href="#">' +
            '<img class="rotation-img" src="' + data.image + '">' +
            '</a>' +
            '</div>';
    }

    //不轮播的cell
    function noRotationHtmlString(index, data) {
        return '<div index="' + index + '" class="rotation-cell">' +
            '<img class="rotation-img" src="' + data.image + '">' +
            '</div>';
    }

    function setupRotationCellClick() {
        $('.rotation-cell').unbind('click');
        $('.rotation-cell').click(function (event) {
            if (api.connectionType == "none") {
                api.toast({
                    msg: '网络异常，请检查网络！'
                });
                return;
            }
            var index = $(this).attr('index');
            var rotationData = rotationArr[parseInt(index)];
            var url1 = rotationData.detail;
            if (url1 != '' && url1 != null && url1 != undefined) {
                if (url1.indexOf("http") == -1) {//包含
                    return;
                }
                var pageParam = {
                    url: isfreelogin(rotationData.islogin, url1),
                    // url: isfreelogin(rotationData.islogin, "http://contest.cfnet.org.cn/rally/ranks.html"),
                    title: rotationData.cname,
                    sourceurl: window.location.pathname,
                    sourcetitle: document.title,
                    ctitle: '轮播图详情页',
                    Newstype: 'lunbo',
                    shareurl: url1,
                    shareType:rotationData.shareType,
                    thumb:rotationData.thumb,
                    shareimg:rotationData.shareimg
                };
                if(rotationData.open_in_browser===1){
                    api.toast({
                        msg: '正在打开,浏览器...',
                        duration: 2000,
                        location: 'bottom'
                    });
                    if(api.systemType==='ios'){
                        api.openApp({
                            iosUrl: isfreelogin(rotationData.islogin, url1)  //打开应用设置界面，支持iOS 8及以上系统
                        });
                    }else {
                        api.openApp({
                            androidPkg: 'android.intent.action.VIEW',
                            uri: isfreelogin(rotationData.islogin, url1)
                        }, function(ret, err) {
                        });
                    }
                    return;
                }

                api.openWin({useWKWebView:true,
                    name: 'indexLunDetailsWindow',
                    url: './html/HomePage/indexLunDetailsWindow.html',
                    slidBackEnabled:false,
                    pageParam: pageParam
                });
            }
        });
    }

    //咨询
    function CheckZixunClick(i) {
        var connectionType = api.connectionType;
        if (connectionType == 'none') {
            ShowToast("暂无网络，请检查网络");
            return;
        }
        var data = zixun_data[i];

        api.openWin({useWKWebView:true,
            name: 'indexLunDetailsWindow',
            url: 'html/HomePage/indexLunDetailsWindow.html',
            pageParam: {
                url: data.detail,
                title: data.cname,
                sourceurl: window.location.pathname,
                sourcetitle: document.title,
                ctitle: '热门资讯详情页',
                Newstype: 'HotNews',
                shareurl: data.detail
            }
        });
    }

    //公开课
    function CheckMoocClick(i) {
        var data = mooc_data[i];
        if(data.types===3){
            api.openWin({useWKWebView:true,
                name: 'CourseCenter_Other',
                url: 'html/CourseCenter/CourseCenter_Other.html',
                pageParam: {
                    url: data.outurl
                }
            });
        }else {
            var param = {
                imgurl: data.image,
                title: data.cname,
                courseType: '2109',
                planid: '',
                courseid: data.cid,
                cstatus: '',
                selected: '1',
                part: '',
                crid: '',
                userType: 'student',
                coursename: data.cname,
                coverimages: data.image,
                isCompetitiveProducts: 1,
                opentype: 'courseCenter',
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            };
            api.openWin({useWKWebView:true,
                name: 'Teacher_StudyCourseInfo',
                url: 'html/Teacher_Teach/Teacher_StudyCourseInfo.html',
                bgColor: '#fff',
                vScrollBarEnabled: false,
                hScrollBarEnabled: false,
                pageParam: param
            });
            addcourse(data.cid);
        }
    }

    //岗位详情
    function CheckJobClick(i) {
        var data = job_data[i];
        api.openWin({useWKWebView:true,
            name: 'Detaila',
            url: 'html/Quarters/Detaila.html',
            pageParam: {
                id: data.id,
                title: data.quarter,
                ctitle: '岗位详情页',
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            },
        });
    }

    //长风之星
    function CheckCfntUserClick(i) {
        if (api.connectionType == "none") {
            api.toast({
                msg: '网络异常，请检查网络！'
            });
            return;
        }
        var data = dipper_data[i];
        if (data.appurl.length < 1) {
            return;
        }
        api.openWin({useWKWebView:true,
            name: 'indexLunDetailsWindow',
            url: 'html/HomePage/indexLunDetailsWindow.html',
            pageParam: {
                url: data.appurl,
                title: data.name,
                ctitle: '长风之星详情页',
                Newstype: 'cfStar',
                sourceurl: window.location.pathname,
                sourcetitle: document.title,
                shareurl: data.appurl
            }
        });
    }

    //长风之星咨询
    function CheckCfntZixunClick(i) {
        if (api.connectionType == "none") {
            api.toast({
                msg: '网络异常，请检查网络！'
            });
            return;
        }
        var data = dipperzixun_data[i];
        api.openWin({useWKWebView:true,
            name: 'indexLunDetailsWindow',
            url: 'html/HomePage/indexLunDetailsWindow.html',
            pageParam: {
                url: data.detail,
                title: data.cname,
                ctitle: '长风之星新闻详情页',
                Newstype: 'cfStar',
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            }
        });
    }

    function openwin(type) {
        var name = '';
        var url = '';
        var pageParam = new Object();
        if (type == 1) {//学生端端 学习模块
//	        	if ($api.getStorage('cfnetppjxid') == 333){
            //     		name = 'StudyFrom';
            //       url = 'StudyFrom.html';
            //        pageParam = {
            // 	sourceurl : window.location.pathname,
            //        sourcetitle : document.titlef
            // };
            name = 'Student_studyWindow';
            url = 'html/Study/Student_studyWindow.html';
            pageParam = {
                sourceurl: window.location.pathname,
                sourcetitle: document.title,
                type: 'Certification',
                Type: 0,
                ifteacherstudy: 'false',//是否是老师端学习
            };
//	        	}else{
//	        		name = 'Student_studyWindow.html';
//		            url = 'html/Study/Student_studyWindow.html';
//		             pageParam = {
//						sourceurl : window.location.pathname,
//			         sourcetitle : document.title
//					};
//	        	}
            $api.setStorage('changfengtype', 1); //区别学生点击的学习集团类型
        } else if (type == 2) {//学生端端 实习模块
            var trainType = $api.getStorage('cfnetTrainSelectType');
            if (trainType == null || trainType == undefined || trainType == "") {
                trainType = $api.getStorage('cfnetSelectType');
            }
            // var practiceJid = $api.getStorage('cfnetppjid');
            // if (practiceJid == undefined || practiceJid == null || practiceJid == '') {
            //     url = 'html/NewPractice/NewPracticeMine_win.html';
            // } else {
            //     if (trainType == 0) {//学生
            //         url = 'html/NewPractice/NewPracticeHomePage_Win.html';
            //     } else {//师傅或hrf
            //         url = 'InternshipIndex.html';
            //     }
            // }
            name = 'TeachertInternshipIndex';
            url = 'InternshipIndex.html';
//             name = 'StudentInternshipIndex';
//	          url = 'html/TrainReport/StudentInternshipIndex.html';
            pageParam = {
                sourceurl: window.location.pathname,
                sourcetitle: document.title,
                type: trainType
            };
            $api.setStorage('changfengtype', 2); //区别学生点击的实习的集团类型
            //j进入学生端实习时替换jxid为实习jid
            $api.setStorage('cfnetppjxid', $api.getStorage('cfnetppjid'));
        } else if (type == 3) {//学生端端 认证模块
            name = 'CertificationForm';
            url = 'CertificationForm.html';
            pageParam = {
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            };
        } else if (type == 4) {//学生端端 竞赛模块
            var connectionType = api.connectionType;
            if (connectionType == 'none') {
                ShowToast("暂无网络，请检查网络");
                return;
            }
            api.hideProgress();
            name = 'Competition';
            url = 'html/Competition/competition_index.html';
            pageParam = {
                type: 1
            };
        } else if (type == 5) {//教师端 教学模块
//	        	if ($api.getStorage('cfnetppjxid') == 333){
            // name = 'Teacher_leran_indx';//授课、课堂
            // url = 'Teacher_leran_indx.html';
            // name = 'Teacher_TeachTabController';//包含课程、授课、课堂、学习计划
            // url = 'html/Teacher_Teach/Teacher_TeachTabController.html';
//	        	}else{
//	        		name = 'Teacher_StudyCourseListWindow.html';
//		          	url = 'html/Teacher_Teach/Teacher_StudyCourseListWindow.html';
            name = 'Teacher_NewCourseListWin';
            url = 'html/Teacher_Teach/Teacher_NewCourseListWin.html';
            pageParam = {
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            };
//	        	}
            $api.setStorage('changfengtype', 1); //区别老师点击的教学的集团类型
        } else if (type == 6) {//教师端 实习模块
            var trainType = $api.getStorage('cfnetTrainSelectType');
            if (trainType == null || trainType == undefined || trainType == "") {
                trainType = $api.getStorage('cfnetSelectType');
            }
            if (trainType == 0) {//如果身份为学生（这种情况强制进入教师）
                trainType = 1;
            }
            var practiceJid = $api.getStorage('cfnetppjid');
            if (practiceJid == undefined || practiceJid == null || practiceJid == '') {
                url = 'html/NewPractice/NewPracticeMine_win.html';
            } else {
                url = 'InternshipIndex.html';
            }
            name = 'TeachertInternshipIndex';
//              name = 'TeachertInternshipIndex';
//				url = 'html/Manage/TeachertInternshipIndex.html';
            pageParam = {
                sourceurl: window.location.pathname,
                sourcetitle: document.title,
                type: trainType
            };
            $api.setStorage('changfengtype', 2); //区别老师点击的实习的集团类型
        } else if (type == 7) {//教师端 培训模块
            // name = 'Teacher_TrainListWin.html';
            // url = './html/Teacher_Teach/Teacher_TrainListWin.html';
            name = 'NewTrainHomePage_Win';
            url = 'html/NewTrain/NewTrainHomePage_Win.html';
        } else if (type == 8) {//教师端 竞赛模块
            var connectionType = api.connectionType;
            if (connectionType == 'none') {
                ShowToast("暂无网络，请检查网络");
                return;
            }
            name = 'Competition';
            url = 'html/Competition/competition_index.html';
            pageParam = {
                type: 1
            };
        } else if (type == 9) {//课堂
            name = 'Study_Classroom';
            url = 'html/Study/Study_Classroom.html';
            pageParam = {
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            };
        } else if (type == 10) {//我的
            name = 'fixed';
            url = 'fixed.html';
        } else if (type == 11) {//认证gan
            name = 'CertificationForm';
            url = 'CertificationForm.html';
        } else if (type == 12) {//就业
            name = 'employmentWin';
            url = 'employmentWin.html';
        } else if (type == 100) {
            name = "livePush";
            url = 'html/temp/livePush.html';
        }

        openWindow(url, pageParam, name);
        // api.openWin({useWKWebView:true,
        //   	name: name,
        //   	url: url,
        //   	animation: {
        //     	type: "none",                //动画类型（详见动画类型常量）
        //     	subType: "from_right",       //动画子类型（详见动画子类型常量）
        //     	duration: 200
        //   	},
        //   	pageParam :pageParam,
        //   	slidBackEnabled: false,
        //   	reload:true,
        // });
    }

    //获取集团id
    function getjituanArr() {
        showProgress();
        var params = {
            uid: $api.getStorage('cfnetppuid')
        };
//	    	 alert("统计分析"+JSON.stringify(params));
        // console.log(JSON.stringify(params)+'\n'+url_getJiTuanList);
        cfnetppPOST(url_getJiTuanList, params, false, function (data, status) {
            console.log("集团数据:" + JSON.stringify(data));
            if (status == 'success') {
                if (data.code == 200) {//两个集团都有
                    stdydata = data.data.jiaoxue;
                    var tags = "";
                    if (stdydata != undefined) {
                        for (var i = 0; i < stdydata.length; i++) {
                            if (i != 0) {
                                tags = tags + " ";
                            }
                            tags = tags + "jid_" + stdydata[i].id;
                        }
                    }
                    /**教学*/
                    if (stdydata.length > 0) {
                        $api.setStorage('stdydata', stdydata);//学习 jid数组
                        $api.setStorage('stdydatatags', tags);//集团标签
                        $api.setStorage('cfnetppjxid', stdydata[0].id);//学习 jid
                        $api.setStorage('tempjid', stdydata[0].id);//存储教学jid用于处理实习学习时的情况
                        $api.setStorage('cfnetppjxidname', stdydata[0].name);
                        // $api.setStorage('cfnetSelectType',stdydata[0].usertpye);
                        $api.setStorage('cfnetSelectType', stdydata[0].usertpye);
                        //登陆成功设置 标签账号
//				            loginSucceedPush();
                    }
                    /**实习*/
                    certificatiodata = data.data.shixi;
                    if (certificatiodata.length > 0) {
                        $api.setStorage('practicedata', certificatiodata);//实习jid数组
                        $api.setStorage('cfnetppjid', certificatiodata[0].id);//实习 jid
                        $api.setStorage('cfnetppjidname', certificatiodata[0].name);
                        var certificatiousertpye = certificatiodata[0].usertpye;

                        if (certificatiousertpye == 2 || certificatiousertpye == 3) {//2：企业师傅，3：企业hr
                            $api.setStorage('cfnetSelectType', certificatiousertpye);
                        }
                        $api.setStorage('cfnetTrainSelectType', certificatiousertpye);
                    } else {
                        $api.setStorage('cfnetppjid', "");
                    }
                    slecttype();
                } else if (data.code == 190) {//只教学
                    $api.setStorage('cfnetppjid', "");
                    stdydata = data.data.jiaoxue;
                    if (stdydata.length > 0) {
                        $api.setStorage('stdydata', stdydata);//学习 jid数组
                        $api.setStorage('stdydatatags', tags);//集团标签
                        $api.setStorage('cfnetppjxid', stdydata[0].id);//学习 jid
                        $api.setStorage('tempjid', stdydata[0].id);//存储教学jid用于处理实习学习时的情况
                        $api.setStorage('cfnetppjxidname', stdydata[0].name);
                        $api.setStorage('cfnetSelectType', stdydata[0].usertpye);
                    }
                    //登陆成功设置 标签账号
//			            loginSucceedPush();
                    slecttype();
                    //处理上次未读消息
                } else if (data.code == 191) {//只实习
                    certificatiodata = data.data.shixi;
                    if (certificatiodata.length > 0) {
                        $api.setStorage('practicedata', certificatiodata);//实习jid数组
                        $api.setStorage('cfnetppjid', certificatiodata[0].id);//实习 jid
                        $api.setStorage('cfnetppjidname', certificatiodata[0].name);
                        $api.setStorage('cfnetSelectType', certificatiodata[0].usertpye);
                        $api.setStorage('cfnetTrainSelectType', certificatiodata[0].usertpye);
                    } else {
                        $api.setStorage('cfnetppjid', "");
                    }
                    SelectUser();
                } else {
                    SelectUser();
                }
            } else {
                SelectUser();
            }
        });
    }

    function SelectUser() {
        api.hideProgress();
        var type11 = $api.getStorage('cfnetSelectType');
        if (type11 == null || type11 == undefined || type11 == "") {
            setTimeout(function () {
                api.hideProgress();
                api.openWin({useWKWebView:true,
                    name: 'SelectUserIdentity',
                    url: 'SelectUserIdentity.html',
                    slidBackEnabled: false,
                });
            }, 1000);
        } else {
            slecttype();
        }
    }

    function ImgPrevious() {
        var img = event.srcElement;
        img.src = "./image/course_placehoder.png";
        img.onerror = null;
    }

    //角色切换
    function slecttype() {
        loadMessageData();
        type = $api.getStorage('cfnetSelectType');
        if (type == 0) {  //展现学生端4个功能按钮
            $('#chat_btn').hide();
            $('#course_top_title').html('推荐课程');
            usertype = 1;
            $('#job').show();
            $('#teacherFunction').hide();
            $('#studentFunction').show();
            //学生端不显示红点
            //          $("#redPoint_div1").hide();
        } else if (type == 1) {   //展现老师端4个功能按钮
            $('#chat_btn').show();
            usertype = 2;
            $('#job').hide();
            $('#studentFunction').hide();
            $('#teacherFunction').show();
        } else {//企业师傅//企业hr
            $('#chat_btn').hide();
            $('#course_top_title').html('推荐课程');
            usertype = 1;
            $('#job').show();
            $('#teacherFunction').hide();
            $('#studentFunction').show();
        }
        loaddata();
    }

    //添加课程
    function addcourse(cid) {
        var param = {
            uid: $api.getStorage('cfnetppuid'),
            cid: cid,
            jid: jid
        };
        cfnetppPOST(url_addCourse, param, false, function (data, status) {
        });
    }

    function toChatClick() {
        api.openWin({useWKWebView:true,
            name: 'chatListWindow',
            url: 'html/chatModule/chatListWindow.html',
            pageParam: {
                groupType: 'teacher',
                teacherGroupObjc: teacherGroupObjc,
                teacherGroupId: teacherGroupId,
                teacherGroupName: teacherGroupName
            }
        });
        $('#redPoint_teacher_group').hide();
    }

    function chartGroup() {
        api.openWin({useWKWebView:true,
            name: 'publicChatGroup',
            url: 'html/chatModule/publicChatGroup.html'
        });

    }

    //判断学生是否参加了学霸赛报名
    function isUserSignUp() {
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            types: 61
        };
        cfnetppPOST(url_isUserSignUp, params, true, function (data, status) {
            //			api.hideProgress();
            if (status == 'success') {
                if (data.code == 200) {
                    aid = data.data.id;
                    //报名id
                    if (aid != '' && aid != null) {
                        var tmp = Date.parse(new Date()).toString();
                        var tmp1 = tmp.substr(0, 10);
                        if (tmp1 < 1509120000) {//10月27日24时0分0秒
                            $('#sign').show();
                            isUserCompetitionSign();
                        } else if (tmp1 >= 1509120000) {
                            $('#sign').hide();
                            $('#dayi').show();
                        } else {
                            $('#sign').hide();
                        }
                        $("#mengcengDiv").show();
                    } else {
                        $('#sign').hide();
                        //未报名状态
                    }
                } else {
                    $('#sign').hide();
                    //未报名状态
                }
            } else {
                $('#sign').hide();
            }
        });
    }

    //判断学生是否参加过学霸赛签到接口
    function isUserCompetitionSign() {
        var timestamp = new Date().getTime();
        var timeStampStr = getLocalSignTime(timestamp.toString());
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            dates: timeStampStr,
            cateid: 3
        };
        cfnetppPOST(url_isUserSign, params, true, function (data, status) {
            //			api.hideProgress();
            if (status == 'success') {
                if (data.code == 200) {
                    var Signstatus = data.data;
                    if (Signstatus == '1' || Signstatus == 1) {//已签到
                        $('.signbtn1').hide();
                        $('.signbtn2').show();

                    } else {//未签到

                        $('.signbtn1').show();
                        $('.signbtn2').hide();

                    }
                } else {
                    //未报名状态
                    $('#sign').hide();
                }
            } else {
                $('#sign').hide();
            }
        });
    }

    //用户学霸赛签到接口
    function UserCompetitionSign() {
        event.stopPropagation();
        var timestamp = new Date().getTime();
        var timeStampStr = getLocalSignTime(timestamp.toString());
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            integral: 5,
            //			aid : aid,
            stype: 0,
            cateid: 3,
            sources: 3,
            types: 0,
            dates: timeStampStr
        };
        cfnetppPOST(url_UserCompetitionSign, params, true, function (data, status) {

            if (status == 'success') {
                if (data.code == 200) {
                    doAddUserFootprint();
                    $('.signbtn1').hide();
                    $('.signbtn2').show();
                } else if (data.code == 190) {
                    ShowToast('签到未开始');
                } else if (data.code == 210) {
                    ShowToast('活动已结束');
                } else {
                    //未报名状态
                }
            } else {
            }
        });
    }

    function doAddUserFootprint() {
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            conts: '今日签到成功，+5积分。',
            types: 2,
            cateid: 3,
            sources: 3,
        };
        cfnetppPOST(url_doAddUserFootprint, params, true, function (data, status) {

            if (status == 'success') {
                if (data.code == 200) {
                } else {

                }
            } else {
            }
        });
    }

    function closeSignDiv() {
        event.stopPropagation();
    }

    function SignDivClick() {
        api.openWin({useWKWebView:true,
            name: 'Competition',
            url: 'html/Competition/Competition.html',
            animation: {
                type: "none",                //动画类型（详见动画类型常量）
                subType: "from_right",       //动画子类型（详见动画子类型常量）
                duration: 200
            },
            slidBackEnabled: false,
            reload: true,
        });
    }

    /**
     *
     * 是否显示活动页，广告页
     *  */
    function isShowHongdong() {
        if (advert_data.length > 0) {//广告
            $("#mengcengDiv").show();
            $("#div_mengceng_img").attr("src", advert_data[0].image);
        } else {
            $("#mengcengDiv").hide();
        }
        if (action_data.length > 0) {//活动
            var hdimg = action_data[0].image;
            $("#hdongDiv").css("background-image", "url(" + hdimg + ")");
            $("#dayi").show();
        } else {
            $("#dayi").hide();
        }
    }

    //解答问题
    function dayiDivClick() {
        // var cUrl="http://m.xueba.cfnet.org.cn/index.php/match/study/index"
        // var cUrl=isfreelogin(1, cUrl)+"&cid=14346&pid=0"
        var cUrl = action_data[0].detail;
        if (cUrl == null || cUrl == undefined || cUrl == "") {
            return;
        }
//		 	alert(action_data[0].islogin);
        if (action_data[0].islogin == 1) {
            var cUrl = isfreelogin(1, cUrl);
        }
        api.openWin({useWKWebView:true,
            name: 'indexLunDetailsWindow',
            url: 'html/HomePage/indexLunDetailsWindow.html',
            pageParam: {
                url: cUrl,
                title: action_data[0].cname,
                shareurl: action_data[0].detail
            }
        });
    }

    //我的，是否显示红点
    function isShowHongdian() {
        $("#redPoint_div1").hide();
    }

    //关闭广告
    function closehongdong() {
        $("#mengcengDiv").hide();
    }

    //打开广告
    function hongdongOpnewin() {
        var cUrl = advert_data[0].detail;
        if (cUrl == null || cUrl == undefined || cUrl == "") {
            return;
        }
        if (action_data[0].islogin == 1) {
            var cUrl = isfreelogin(1, cUrl);
        }
//		   alert(111);
        api.openWin({useWKWebView:true,
            name: 'indexLunDetailsWindow',
            url: 'html/HomePage/indexLunDetailsWindow.html',
            pageParam: {
                url: cUrl,
                title: advert_data[0].cname,
                shareurl: advert_data[0].detail
            }
        });
    }

    function loadMessageData() {
        var jid = $api.getStorage('cfnetppjxid');
        if (jid == null || jid == undefined || jid == '') {
            jid = 0;
        }
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            jid: jid,
            sjid: $api.getStorage('cfnetppjid'),//实习 jid
            page: 1,
            rows: 2
        };
        var url = url_stuMessageList;//学生
        if ($api.getStorage('cfnetSelectType') == 1) {//老师
            url = url_toDoMessageList
        } else if ($api.getStorage('cfnetSelectType') == 2) {
            url = url_getMasterNoList
        }
        // alert("统计分析"+JSON.stringify(params));
        cfnetppPOST(url, params, false, function (data, status) {
            // alert("统计分析"+JSON.stringify(data));
            if (status == 'success') {
                if (data.status == true) {
                    var msgs = data.data.list;
                    if (msgs != undefined && msgs != null && msgs != '' && msgs.constructor == Array && msgs.length > 0) {
                        $("#massageUl").show();
                        setMessageHtml(msgs, msgs.length);
                    } else {
                        $("#massageUl").hide();
                    }
                } else {
                    $("#massageUl").hide();
                }
            } else {
                $("#massageUl").hide();
            }
        });
    }

    function setMessageHtml(data, len) {
        // alert("统计分析"+JSON.stringify(data));
        var messages = '';
        for (var i = 0; i < len; i++) {
            var typeStr = '';
            var dataobject = data[i];
            switch (parseInt(dataobject.type)) {
                case NEW_STUDY_TYPE://新增课程
                    typeStr = '你有新的课程上线了';
                    break;
                case QD_TYPE://新签到,进入详情
                    typeStr = '老师新增一个签到';
                    break;
                case DC_TYPE://调查,进入详情
                    typeStr = '老师新增一项调查';
                    break;
                case TL_TYPE://讨论,进入详情
                    typeStr = '老师新增一项讨论';
                    break;
                case TW_TYPE://提问,进入详情
                    typeStr = '老师新增一项提问';
                    break;
                case NEW_ZY_TYPE://有新的作业需要提交
                    typeStr = '你有新的作业《' + dataobject.cdetailtitle + '》需要提交';
                    break;
                case NEW_CY_TYPE://有新的测验需要提交
                    typeStr = '测验《' + dataobject.cdetailtitle + '》已经开始了';
                    break;
//					case NEW_PJ_TYPE://有新的评价需要提交
//					typeStr ='老师发布一个新三方评价';
//					break;
                case NEW_DC_TYPE://有新的调查需要提交
                    typeStr = '快去参加调查《' + dataobject.cdetailtitle + '》吧';
                    break;
                case STUDENT_NEED_QD_TYPE://学生签到
                    typeStr = dataobject.content;
                    break;
                case STUDENT_NEED_RB_TYPE://学生需要提交日报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_NEED_ZB_TYPE://学生需要提交周报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_NEED_YB_TYPE://学生需要提交月报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_NEED_SB_TYPE://学生提要提交实习报告
                    typeStr = dataobject.content;
                    break;
                case TEACHER_ZY_TYPE://老师对你的作业做出了评分通过
                    typeStr = '你提交的作业《' + dataobject.cdetailtitle + '》完成了审阅';
                    break;
                case TEACHER_ZY_TYPE_BH://老师对你的作业做出了评分驳回
                    typeStr = '你提交的作业《' + dataobject.cdetailtitle + '》被驳回';
                    break;
                case TEACHER_CY_TYPE://老师对你的测验做出了评分
                    typeStr = '老师批改了你的测验《' + dataobject.cdetailtitle + '》';
                    break;
                case TEACHER_PJ_TYPE://老师对你的三方评价做出了评分
                    typeStr = '你的评价《' + dataobject.cdetailtitle + '》成绩已经出炉了';
                    break;
                case COURSE_CY://课程中有测验需要批卷
                    typeStr = '学生提交了测验《' + dataobject.cdetailtitle + '》需要审阅';
                    break;
                case COURSE_ZY://课程中有作业需要审阅
                    typeStr = '学生提交了作业《' + dataobject.cdetailtitle + '》需要批改';
                    break;
                case COURSE_PJ://课程中有评价需要评分
                    typeStr = '学生提交了评价《' + dataobject.cdetailtitle + '》需要评分';
                    break;
//					case COURSE_DC://学生提交调查调查
//					typeStr  ='学生提交了调查《'+dataobject.cdetailtitle+'》';;
//					break;
                case NEW_KH_TYPE://课程中有考核需要查看
                    typeStr = '老师发布了一个新的考核';
                    break;
                case NEW_KH_SUBMIT_TYPE://课程中有考核需要查看
                    typeStr = '您有一个新的考核需要评分';
                    break;
                case TEACHER_RB_TYPE://教师对实习周报进行了评分
                    typeStr = dataobject.content;
                    break;
                case TEACHER_ZB_TYPE://教师对实习周报进行了评分
                    typeStr = dataobject.content;
                    break;
                case TEACHER_YB_TYPE://教师对实习月报、进行了评分
                    typeStr = dataobject.content;
                    break;
                case TEACHER_SB_TYPE://教师对实习实习报告进行了评分
                    typeStr = dataobject.content;
                    break;
//					case NEW_JOB_TYPE://上线了新的认证岗位
//					typeStr ='上线了新的认证岗位';
//					break;
//					case NEW_RENZHENG_TYPE://更新了新的认证新闻内容
//					break;
//					case RENZHENG_TONGGUO_TYPE://认证报名审核是否通过
//					typeStr ='你认证报名已审核';
//					break;
//					case EXAM_TONGGUO_TYPE://申请考试审核是否通过
//					typeStr ='你申请考试审核已审核';
//					break;
//					case EXAM_BEFORE_DAY_TYPE://考试时间前一天
//					typeStr ='请你明天进行考试';
//					break;
//					case EXAM_DAY_TYPE://考试时间当天
//					break;
//					case EXAM_LATER_TYPE://考试时间过后有考试未参加
//					break;
//					case EXAM_COMPLETE_TYPE://考试已经审阅完成
//					typeStr ='你考试已审阅';
//					break;
                case STUDENT_NEED_QD_TYPE://学生签到
                    typeStr = dataobject.content;
                    break;
                case TEACHER_QD_TYPE://学生提交了日报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_RB_TYPE://学生提交了日报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_ZB_TYPE://学生提交了周报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_YB_TYPE://学生提交了月报
                    typeStr = dataobject.content;
                    break;
                case STUDENT_SB_TYPE://学生提交了实习报告
                    typeStr = dataobject.content;
                    break;
                case  NEW_JOB_TYPE://上线了新的认证岗位
                case RENZHENG_TONGGUO_TYPE://认证报名审核通过
                case RENZHENG_NO_TONGGUO_TYPE: //认证报名审核未通过
                case EXAM_TONGGUO_TYPE://申请考试审核是通过

                case EXAM_NO_TONGGUO_TYPE:// //申请考试审核是通过
                case EXAM_DAY_TYPE: //考试时间当天  认证岗位名称考试已经开始，请于9:00-16:00参加考试
                case EXAM_COMPLETE_TYPE: //考试已经审阅完成
                case  NEW_PX://近期培训有更新
                case COURSE_PUBLIC_TYPE: //公共课程上线了新的课程，也许你会喜欢
                case COURSE_NETWORK_TYPE://直播课程《课程名称》马上要开始了
                    typeStr = dataobject.content;
                    break;
                case MASTER_NEW_STUDENT://师傅端有新徒弟
                    typeStr = dataobject.content;
                    break;
                case MASTER_NEW_STUDENT_YB://师傅要批阅报告
                    typeStr = dataobject.content;
                    break;
                case MASTER_DO_SCORE://师傅评分
                    typeStr = dataobject.content;
                    break;
                case MASTER_COURSE_ChAT:
                    typeStr = dataobject.content;
                    break;
                default:
                    $("#massageUl").hide();
                    return;
            }

            if (len == 1) {
                var message = '<div class="base_black_grey" style="  padding-top:13px; " >' +
                    '<div class="div_message_dian left" ></div><span class="left_5_right_5 base_black_grey ">'
                    + typeStr + '</span>' +
                    //							<samp class="base_grey base_tag_font"> 1小时前</samp>
                    '</div>';
            } else {
                var message = '<div class="base_black_grey">' +
                    '<div class="div_message_dian left"></div><span class="left_5_right_5 base_black_grey ">'
                    + typeStr + '</span>' +
                    //							<samp class="base_grey base_tag_font"> 1小时前</samp>
                    '</div>';
            }
            messages = messages + message;
        }
        $("#massageDiv").html(messages);
    }

    //添加章节操作
    function AddChapterInformation(pid, cid, vid) {
        var params = {
            uid: $api.getStorage('cfnetppuid'),
            jid: jid,
            pid: pid,
            cid: cid,
            vid: vid
        };
        cfnetppPOST(url_GetChapterById, params, true, function (data, status) {
            // alert("添加章节操作"+JSON.stringify(data));
            if (status == 'success') {
                if (data.code == 200) {

                } else {

                }
            } else {
            }
        });
    }

    //打开选择课程页f
    function openSelectCourseWin() {
        api.openWin({useWKWebView:true,
            name: 'CourseCenter_SelectCourseListWin',
            url: 'html/CourseCenter/CourseCenter_SelectCourseListWin.html',
            pageParam: {
                sourceurl: window.location.pathname,
                sourcetitle: document.title
            }
        });
    }

    function setupCFClassFrame() {
        var currentSysType = api.systemType;
        if (currentSysType == 'ios') {
            return;
        }
        var uiMode = api.uiMode;
        if (uiMode == 'pad') {//如果是pad
            $('#suspension_win').show();
        }
        setupModel($('#suspension_win'));
    }

    //打开未来课堂
    function toCFClassClick() {
        var account = $api.getStorage('cfnetppaccount');
        var password = $api.getStorage('cfnetpppassword');
        var openUrl = "cfclass://open?" + account + "&&&&" + password;
        api.openApp({
            androidPkg: 'com.mcclassstu.Activity',
            mimeType: 'text/html',
            uri: openUrl
        }, function (ret, err) {
            if (ret) {
                // console.log(JSON.stringify(ret));
            } else {
                // console.log(JSON.stringify(err));
                window.location.href = openUrl;
            }
        });
    }

    //设置测试正式服
    function toChangeNetStatus() {
        var netStatus = $api.getStorage('app_net_status');
        if (netStatus != undefined && netStatus != null) {
            if (netStatus == '1') {
                $api.setStorage('app_net_status', '0');
            } else {
                $api.setStorage('app_net_status', '1');
            }
        } else {
            $api.setStorage('app_net_status', '0');
        }
        api.rebootApp();//重启app
    }

</script>
</html>
